class Solution {
public:
    int sumOddLengthSubarrays(vector<int>& arr) {
        int sum = 0 ;
        for (int i = 0 ; i < arr.size() ; i ++ )
        {
            for (int j = 1 ; j + i -1 < arr.size() ; j = j +2 )
            {
                for (int k = i ; k <= j + i -1 ; k ++ )
                {
                    sum = sum + arr[k];
                }
            }
        }
        return sum ;
    }
};